package com.lottery.im.module.result.adapter.result.item;

import android.support.annotation.Nullable;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lottery.im.R;
import java.util.List;

public class Horizontal115Adapter extends BaseQuickAdapter<String, BaseViewHolder> {
  public Horizontal115Adapter(@Nullable List<String> data) {
    super(R.layout.item_horizontal_lottery_list, data);
  }

  @Override protected void convert(BaseViewHolder helper, String item) {
    helper.setText(R.id.tv_num, item);
    helper.getView(R.id.tv_num).setBackgroundResource(getResourceId("lottery_ball_" + item));
  }

  //根据图片名称取得对应图片
  public int getResourceId(String name) {
    int resId = mContext.getResources().getIdentifier(name, "drawable", mContext.getPackageName());
    //解析资源文件夹下，id为resId的图片
    return resId;
  }
}